<?php /* Smarty version Smarty-3.1.8, created on 2014-09-02 17:37:22
         compiled from "C:\wamp\www\framework\calidad\views\medicion\verificacion.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1999253e8e8bc96ed24-75769805%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '2c03fa14eae980ba4ade95f6d083159ca94628d3' => 
    array (
      0 => 'C:\\wamp\\www\\framework\\calidad\\views\\medicion\\verificacion.tpl',
      1 => 1409679440,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1999253e8e8bc96ed24-75769805',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_53e8e8bc9e34f6_20934611',
  'variables' => 
  array (
    'id' => 0,
    'folio' => 0,
    'orden' => 0,
    'operaciones' => 0,
    'checked' => 0,
    'operacion' => 0,
    'inspecciones' => 0,
    'inspeccion' => 0,
    'muestras' => 0,
    'muestra' => 0,
    'url' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_53e8e8bc9e34f6_20934611')) {function content_53e8e8bc9e34f6_20934611($_smarty_tpl) {?><form method="post" enctype="multipart/form-data">
<table id="encabezado">
    <tr>
        <th><strong><?php echo $_smarty_tpl->tpl_vars['id']->value;?>
:</strong></th>
        <td><input type="hidden" name="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
" id="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['folio']->value)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['orden']->value : $tmp);?>
"/><?php echo (($tmp = @$_smarty_tpl->tpl_vars['folio']->value)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['orden']->value : $tmp);?>
</td>
    </tr>
    <tr>
        <th><strong>Operacion:</strong></th>
        <td>
        <?php if (count($_smarty_tpl->tpl_vars['operaciones']->value)==1){?>
            <?php $_smarty_tpl->tpl_vars['checked'] = new Smarty_variable("checked = 'true'", null, 0);?>
        <?php }?>
        <?php  $_smarty_tpl->tpl_vars['operacion'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['operacion']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['operaciones']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['operacion']->key => $_smarty_tpl->tpl_vars['operacion']->value){
$_smarty_tpl->tpl_vars['operacion']->_loop = true;
?>
            <label><input id="operacion" name="operacion" <?php echo $_smarty_tpl->tpl_vars['checked']->value;?>
 type="radio" required="required" value="<?php echo $_smarty_tpl->tpl_vars['operacion']->value['operacion'];?>
"/><?php echo $_smarty_tpl->tpl_vars['operacion']->value['operacion'];?>
</label>
        <?php } ?>
        </td>
    </tr>
    <tr>
        <th><strong>Serie:</strong></th>
        <td>
            <input id="serie" name="serie"/>
        </td>
    </tr>
    <tr>
        <th><strong>Tipo inspeccion:</strong></th>
        <td>
        <?php  $_smarty_tpl->tpl_vars['inspeccion'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inspeccion']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['inspecciones']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inspeccion']->key => $_smarty_tpl->tpl_vars['inspeccion']->value){
$_smarty_tpl->tpl_vars['inspeccion']->_loop = true;
?>
            <label><input id="<?php echo $_smarty_tpl->tpl_vars['inspeccion']->value['nombre'];?>
" name="inspeccion" type="radio" required="required" value="<?php echo $_smarty_tpl->tpl_vars['inspeccion']->value['id'];?>
"/><?php echo $_smarty_tpl->tpl_vars['inspeccion']->value['nombre'];?>
</label>
        <?php } ?>
        </td>
    </tr>
    <tr>
        <th><strong>AQL:</strong></th>
        <td>
        <?php  $_smarty_tpl->tpl_vars['muestra'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['muestra']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['muestras']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['muestra']->key => $_smarty_tpl->tpl_vars['muestra']->value){
$_smarty_tpl->tpl_vars['muestra']->_loop = true;
?>
            <label><input id="muestreo" name="muestreo" type="radio" required="required" value="<?php echo $_smarty_tpl->tpl_vars['muestra']->value['id'];?>
"/><?php echo $_smarty_tpl->tpl_vars['muestra']->value['AQL'];?>
</label>
        <?php } ?>
        </td>
    </tr>
    <tr>
        <th><strong>Cantidad:</strong></th>
        <td><input required="required" id="cantidad" disabled="true" type="number" min="2" name="cantidad" value="2"/></td>
    </tr>
    <tr>
        <th><strong>Tipo de captura:</strong></th>
        <td>
            <label><input id="file" name="file" type="radio" checked="true" value="1"/>Capturar medidas</label>
            <label><input id="file" name="file" type="radio" value="0"/>Cargar pdf</label>
        </td>
    </tr>
    <tr>
        <th colspan="2"><input id="submit" type="button" value="Agregar"/></th>
    </tr>
    </table>
    <div id="capturas">
    </div>
</form>

<script>
    $(document).ready(
        function(){
            $('input:radio[name=inspeccion]').click(function(event){
                valor = $('input:radio[name=inspeccion]:checked').val();
                switch(valor){
                    case '3':
                        $('input:radio[name=muestreo]').removeAttr('disabled');
                        $('#cantidad').removeAttr('disabled');
                        break;
                    case '1':
                        $('input:radio[name=muestreo]').attr('disabled','true');
                        $('#cantidad').attr('disabled','true');
                        break;
                    case '2':
                        $('input:radio[name=muestreo]').attr('disabled','true');
                        $('#cantidad').attr('disabled','true');
                        break;
                }
            });
            
            $('#submit').click(function(event){
                $('#capturas').load(
                    '<?php echo $_smarty_tpl->tpl_vars['url']->value;?>
',
                    {
                        <?php echo $_smarty_tpl->tpl_vars['id']->value;?>
:<?php echo (($tmp = @$_smarty_tpl->tpl_vars['folio']->value)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['orden']->value : $tmp);?>
,
                        operacion:$('input:radio[name=operacion]:checked').val(),
                        inspeccion:$('input:radio[name=inspeccion]:checked').val(),
                        serie:$('input:text[name=serie]').val(),
                        file:$('input:radio[name=file]:checked').val(),
                        cantidad:!$('#cantidad').attr('disabled') ? $('#cantidad').val() : "1",
                        muestreo:$('input:radio[name=muestreo]:checked').val()
                    },
                    function( response, status, xhr ) {
                        if ( status == "error" ) {
                            var msg = "Sorry but there was an error: ";
                            $( "#capturas" ).html("<h2>"+ msg + xhr.status + " " + xhr.statusText +"</h2>");
                        }
                    }
                );
                //$("#encabezado input").attr('disabled','true');
            });
            
            /*if($('#folio').length()){
                $("#encabezado input").attr('disabled','true');
            }*/
        }
    );
    
</script><?php }} ?>